<?php

/**
 * model_audit
 * 审批权限
 */

	class Model_audit extends YOU {

	public function __construct()
	{
		parent::__construct();
	}

	/** 读取成配置 **/
	public function getIni()
	{
		$audit_lists = $this->getAll();
		foreach ($audit_lists as $key => $value){
			$audit[$value['audit_id']] = $value['audit_name'];
		}

		return $audit;
	}

	/** 读取列表 **/
	public function getAll($field = "*")
	{
		$audit_lists = $this->db->fetchAll("SELECT {$field} FROM `tbl_audit` ");

		return $audit_lists;
	}

	/** 读取单条信息 **/
	public function getInfo($audit_id, $field = "*")
	{
		$data = $this->db->fetchRow("SELECT {$field} FROM `tbl_audit` WHERE audit_id='{$audit_id}' ");

		return $data;
	}
	/** 读取多条信息 **/
	public function getInfoAll($type_id, $field = "*")
	{
		$list = $this->db->fetchAll("SELECT {$field} FROM `tbl_audit` WHERE user_id='{$type_id}' ");
		
		return $list;
	}
	/** 详细读取信息 **/
	public function getAInfo($audit_type,$type_id,$user_id, $field = "*")
	{	
		
		$data = $this->db->fetchRow("SELECT {$field} FROM `tbl_audit` WHERE audit_type='{$audit_type}' AND type_id ={$type_id} AND user_id = {$user_id} ");

		return $data;
	}
	/** 详细读取信息 **/
	public function getAInfoAll($audit_type,$type_id, $field = "*")
	{	
		
		$data = $this->db->fetchAll("SELECT {$field} FROM `tbl_audit` WHERE audit_type='{$audit_type}' AND type_id ={$type_id}  ");

		return $data;
	}
}



?>